<template>
  <div class="groupCard">
    <div v-for="data in products" class="contene_app">
      <span class="app_top">{{ data.name }}</span>
      <div class="groupCard_item" v-for="(item,index) in data.itemList">
        <el-image class="groupCard_item_img" :src="item.thumbnail"></el-image>
        <div class="groupCard_item_content">
          <span class="groupCard_item_content_title">{{ item.name }}</span>
          <div class="groupCard_item_content_botton">
            <div class="groupCard_item_content_botton_price">
              <span class="groupCard_item_content_botton_priceIcon">¥</span>
              <span class="groupCard_item_content_botton_priceTitle">{{ data.price }}</span>
            </div>
          </div>
        </div>
      </div>
    </div>
    <noData v-if="products.length===0" style="height: 100%"></noData>
  </div>
</template>

<script>
import {groupList} from '@/api/groupBuy'
import utils from '../../../../utils/utils'
import noData from "@/views/designer/components/product/components/noData";
export default {
  name: "groupCard",
  data() {
    return {
      products: []
    }
  },
  components:{
    noData
  },
  created() {
    this.loadProduct()
  },
  methods: {
    loadProduct() {
      let param = new URLSearchParams()
      param.append('mchId', '10200')
      param.append('type', 2)
      groupList(param).then(res => {
        res.data.data.forEach(element => {
          this.products.push(element)
        });
        // if (res.data.data.length == 0){
        //   return;
        // }
        // res.data.data.forEach(item=>{
        //   if (utils.isNull(item.logo)){
        //     item.logo='http://cdnx.rzico.com/images/pcLogo.png'
        //   }
        //   if (utils.isNull(item.name)){
        //     item.name='例如：厦门睿商团购'
        //   }
        //   if (utils.isNull(item.point)){
        //     item.point=300
        //   }
        //   if (item.itemList.length > 0){
        //     item.itemList.forEach(function (items){
        //       items.thumbnail = utils.thumbnail(items.thumbnail,320,320)
        //     })
        //   }
        // })
        // this.products=res.data.data
      })
    }
  }
}
</script>

<style scoped>
.groupCard {
  width: 355px;
  padding-top: 10px;
  padding-bottom: 10px;
  padding-left: 10px;
  padding-right: 10px;
  box-sizing: border-box;
  background-color: white;
  margin-left: 10px;
  border-radius: 6px;
}

.groupCard_header {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
}

.groupCard_header_title {
  font-size: 18px;
  font-weight: 500;
}

.groupCard_header_right {
  display: flex;
  flex-direction: row;
  align-items: center;
}

.groupCard_header_right_title {
  font-size: 14px;
  font-weight: 400;
  color: rgba(26, 26, 30, 0.3);
}

.groupCard_header_right_icon {
  font-size: 14px;
  font-weight: 400;
  color: rgba(26, 26, 30, 0.3);
  margin-left: 2px;
}

.groupCard_item {
  display: flex;
  flex-direction: row;
  border-bottom-color: #F2F6FC;
  border-bottom-style: solid;
  border-bottom-width: 1px;
  padding-bottom: 10px;
  flex-grow: 1;
  margin-top: 10px;
}

.groupCard_item:last-child {
  display: flex;
  flex-direction: row;
  border-bottom-color: white;
  border-bottom-style: solid;
  border-bottom-width: 1px;
  padding-bottom: 0px;
  flex-grow: 1;
  margin-top: 10px;
}

.groupCard_item_img {
  width: 80px;
  height: 80px;
  border-radius: 2px;
}

.groupCard_item_content {
  margin-left: 10px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.groupCard_item_content_title {
  flex-grow: 1;
  display: block;
  font-size: 14px;
  line-height: 20px;
  text-overflow: -o-ellipsis-lastline;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  width: 240px;
}

.groupCard_item_content_botton {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
}

.groupCard_item_content_botton_price {
  display: flex;
}

.groupCard_item_content_botton_priceIcon {
  font-size: 12px;
  font-weight: bold;
  color: rgba(231, 91, 83, 1);
  margin-right: 2px;
  line-height: 22px;
}

.groupCard_item_content_botton_priceTitle {
  font-size: 18px;
  font-weight: bold;
  color: rgba(231, 91, 83, 1);
  line-height: 18px;
}

.contene_app{
  border-bottom-color: #F2F6FC;
  border-bottom-style: solid;
  border-bottom-width: 1px;
  margin-bottom: 10px;
  padding-bottom: 10px;
}

.contene_app:last-child{
  border-bottom-color: white;
  border-bottom-style: solid;
  border-bottom-width: 1px;
  padding-bottom: 0px;
  margin-bottom: 0px;
}
</style>
